package com.adley.service.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
public class HelloController {
    @Value("${server.port}")
    private Integer port;
    @Value("${delay.seconds:0}")
    private Integer delaySeconds;

    @GetMapping("/hello")
    public String hello() {
        try {
            Thread.sleep(TimeUnit.SECONDS.toMills(delaySeconds));
        } catch (InterruptedException e) {
            e.pringStackTrace();
        }
        return "hello "+port;
    }
}